package com.example.physicalexaminationsystem.controller;

import com.example.physicalexaminationsystem.dto.ResponseDto;
import com.example.physicalexaminationsystem.service.DoctorService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author shiwenzhuo
 * 
 * @description
 */
@RestController
@RequestMapping("/api/doctor")
public class DoctorController {
    @Resource
    private DoctorService doctorService;

    //获取医生信息
    @RequestMapping("/getDoctorList")
    public ResponseDto getDoctorList() {
        return ResponseDto.success(doctorService.getDoctorList());
    }

    //添加医生信息
    @RequestMapping("/addDoctor")
    public ResponseDto addDoctor(@RequestBody Map<String, Object> params) {
        return doctorService.addDoctor(params);
    }

    //删除医生信息
    @RequestMapping("/deleteDoctorById")
    public ResponseDto deleteDoctorById(@RequestParam Long id) {
        doctorService.deleteDoctorById(id);
        return ResponseDto.success();
    }

    //修改医生信息
    @RequestMapping("/updateDoctor")
    public ResponseDto updateDoctor(@RequestBody Map<String, Object> params) {
        return doctorService.updateDoctorById(params);
    }
}
